package com.cn.config;
import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhiyuan
 */
@Configuration
public class RabbitmqConfig {
    //1.配置交换机
    @Bean("accountExchange")
    public DirectExchange directExchange()
    {
        return new DirectExchange("accountExchange");
    }
    //2.配置队列
    @Bean("accountQueue")
    public Queue queue()
    {
        return QueueBuilder.durable("accountQueue").build();
    }
    //3.交换机绑定
    @Bean
    public Binding deadLetterBindingQAD(@Qualifier("accountQueue") Queue queueD,
                                        @Qualifier("accountExchange") DirectExchange yExchange) {
        return BindingBuilder.bind(queueD).to(yExchange).with("");
    }
}
